Calling methods within same JavaScript class [Prototype]

Posted by eldeejay on Stack Overflow See other posts from Stack Overflow or by eldeejay
Published on 2010-03-26T18:39:03Z Indexed on 2010/03/27 3:53 UTC
Read the original article Hit count: 290

Filed under:
|
|

I've created a class in Javscript using the prototype Class.Create complete with the initialize function and a few other functions. However, in one of my functions I want to reference another function in the same class, but cannot seem to get the syntax correct.

e.g.

    var sampleClass = Class.create({

            initialize: function(){

                //do the init work here

        },

        functionA: function(){

            //do some more stuff here
        }
        functionB: function(){
            //Do some stuff
            functionA()
        }
}

I've tried calling functionA() , this.functionA() but nothing works I just get errors. I know how to call the functions externally when the class has been instantiated, but not reference a function from within the class itself.

Thanks

© Stack Overflow or respective owner

Related posts about prototype

Related posts about JavaScript